package com.cssw.fyzb.core.dao.acct;

import com.cssw.fyzb.core.model.dodb.Acct;
import com.cssw.fyzb.core.model.dodb.AcctLog;
import com.ydn.dbframe.plugin.activerecord.Page;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Author zhouxu
 * @create 2020-12-17 22:03
 */
public interface AcctDao {

    /**
     * 更新账本统一走此方法，校验值不能为负数
     *
     * @param acct
     */
    void updateAcct(Acct acct);

    void createAcct(Long userId);

    Long createAcct(Long userId, String acctType);

    Acct queryFAcct(Long userId);

    Acct queryYAcct(Long userId);

    Acct queryGAcct(Long userId);

    Acct queryAcctByUIdAndType(Long userId, String acctType);

    Acct queryAcctById(Long acctId);

    List<Acct> listAcctByUserId(Long userId);

    Page<AcctLog> listAcctLog(Map param, int page, int limit);

    void addBalance(Long userId, String acctType, BigDecimal value,
                    String tradeId, String tradeType, String busiType);

    void addFBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void addYBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void addGBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void addBalance(Long acctId, BigDecimal value,
                    String tradeId, String tradeType, String busiType);

    void addBalance(Acct acct, BigDecimal value,
                    String tradeId, String tradeType, String busiType);

    void addBalance(Long userId, String acctType, BigDecimal value);

    void minusBalance(Long userId, String acctType, BigDecimal value);

    void minusBalance(Long userId, String acctType, BigDecimal value,
                      String tradeId, String tradeType, String busiType);

    void minusBalance(Long acctId, BigDecimal value,
                      String tradeId, String tradeType, String busiType);

    void minusBalance(Acct acct, BigDecimal value,
                      String tradeId, String tradeType, String busiType);

    void minusFrozenBalance(Long userId, String acctType, BigDecimal value,
                            String tradeId, String tradeType, String busiType);

    void minusFrozenBalance(Long acctId, BigDecimal value,
                            String tradeId, String tradeType, String busiType);

    void minusFrozenBalance(Acct acct, BigDecimal value,
                            String tradeId, String tradeType, String busiType);

    void minusFBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void minusYBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void minusGBalance(Long userId, BigDecimal value, String tradeId, String tradeType, String busiType);

    void frozenBalance(Long userId, String acctType, BigDecimal value,
                       String tradeId, String tradeType, String busiType);

    void frozenBalance(Long acctId, BigDecimal value,
                       String tradeId, String tradeType, String busiType);

    void frozenBalance(Acct acct, BigDecimal value,
                       String tradeId, String tradeType, String busiType);

    void unfrozenBalance(Long userId, String acctType, BigDecimal value,
                         String tradeId, String tradeType, String busiType);

    void unfrozenBalance(Long acctId, BigDecimal value,
                         String tradeId, String tradeType, String busiType);

    void unfrozenBalance(Acct acct, BigDecimal value,
                         String tradeId, String tradeType, String busiType);

    void addAcctLog(Long userId, String acctType, String feeInDe, BigDecimal fee, String tradeId, String tradeType, String busiType);

    void addAcctLog(Long acctId, String feeInDe, BigDecimal fee, String tradeId, String tradeType, String busiType);

}
